package org.pangu.test.publish;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhangyj
 * @date 2022/7/19 22:57
 */
public class LoginSupport {

    private List<LoginListener> listenerList = new ArrayList<>();

    public void addListener(LoginListener listener) {
        this.listenerList.add(listener);
    }

    public void fireListener(LoginInfo loginInfo) {
        LoginEvent loginEvent = new LoginEvent("login", loginInfo);//生成事件

        for (LoginListener loginListener : listenerList) {
            loginListener.onEvent(loginEvent);
        }

    }
}
